from basic_module import *

class Interface:
    
    def __init__(self, name):
        self.name = name
    
    def divide_string_4(self, string):
        parts = string.split('|')
        return parts[0], parts[1], parts[2], parts[3]
    
    def divide_string_2(self, string):
        parts = string.split('|')
        return parts[0], parts[1], parts[2], parts[3]
  
    def choose_action(self, string):
        if string[0] == 'm':
            for i in xrange(len(string)):
                if string[i] == '|':
                    self.move_shadow(string[i+1:])                    
        if string[0] == 'a':
            for i in xrange(len(string)):
                if string[i] == '|':
                    self.attack_shadow(string[i+1:])    
  
    def move_shadow(self, string):
        line1, row1, line2, row2 = divide_string_4(string)
        CombatGame.move(9-line1, 9-row1, 9-line2, 9-row2)



    def attack_mode(self):
        CombatGame.change_status(2)
        
    def battle_mode(self):
        CombatGame.change_status(1)        
        
    
      
  
      
       